package com.test.kfk.config;

import org.apache.kafka.clients.admin.AdminClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.KafkaAdmin;
import org.springframework.kafka.core.ProducerFactory;


/**
 * @author chen_lei
 * @date 2020/11/18 10:55
 */
@Configuration
public class KafkaProduceCfg {


    @Autowired
    ProducerFactory producerFactory;

    @Autowired
    private KafkaAdmin kafkaAdmin;

    @Bean  //kafka客户端
    public AdminClient adminClient() {
        AdminClient adminClient = AdminClient.create(kafkaAdmin.getConfigurationProperties());
        return adminClient;
    }


}
